package com.raymond.smgp.handler;

import com.raymond.client.handler.BaseHandler;
import com.raymond.smgp.msg.request.DeliverRequestMessage;
import com.raymond.smgp.msg.response.DeliverResponseMessage;
import com.raymond.smgp.utils.SmgpMsgId;
import io.netty.channel.ChannelHandlerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 状态报告和上行业务处理
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-08-06 11:45
 */
public class DeliverRequestMessageHandler extends BaseHandler<DeliverRequestMessage> {
    private final static Logger logger = LoggerFactory.getLogger(DeliverRequestMessageHandler.class);

    @Override
    protected void channelRead(ChannelHandlerContext ctx, DeliverRequestMessage msg) throws Exception {
//        logger.debug("状态报告和上行业务:{}", JSONObject.toJSONString(msg));
        ctx.writeAndFlush(new DeliverResponseMessage(msg.getSequenceId(), SmgpMsgId.getInstance().nextId() + ""));
    }
}
